package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.ProductImgQueryClient;
import com.zqh.myfmmall.result.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-19 19:22
 */
@Slf4j
public class ProductImgQueryClientFallback implements FallbackFactory<ProductImgQueryClient>{
    @Override
    public ProductImgQueryClient create(Throwable cause) {
        log.warn("exception in calling productimgquery service" + cause);
        return new ProductImgQueryClient(){
            @Override
            public Result getMainImg(String productId) {
                return Result.internalServerError();
            }

            @Override
            public Result getMainImgs(List<String> productId) {
                return Result.internalServerError();
            }

            @Override
            public Result retrieve(String productId) {
                return Result.internalServerError();
            }
        };
    }
}
